package com.shujia.spark.mllib

import com.huaban.analysis.jieba.{JiebaSegmenter, SegToken}

import java.util
import scala.collection.mutable.ListBuffer


object Demo05JiebaUtil {
  def fit(line: String): List[String] = {
    val tokens: util.List[SegToken] = new JiebaSegmenter()
      .process(line, JiebaSegmenter.SegMode.SEARCH)
    val list: ListBuffer[String] = ListBuffer[String]()

    tokens.forEach(s=>{
      list.append(s.word)
    })

    list.toList
  }

  def main(args: Array[String]): Unit = {
    val line: String = "武汉市长江大桥"

    println(Demo05JiebaUtil.fit(line))


  }

}
